﻿using Model;
using System;
using System.Collections.Generic;
using System.Text;


public class RestfulAPIModel
{
    public static Model.Result<T> SuccessReult<T>(T data, string str = "操作成功")
    {
        return new Result<T>()
        {
            Data = data,
            Message = str,
            Code = 0
        };
    }

    public static Model.Result<T> SuccessReult<T>(string str = "操作成功")
    {
        return new Result<T>()
        {
            Message = str,
            Code = 0
        };
    }

    public static Model.Result SuccessReultString(string str = "操作成功")
    {
        return new Result()
        {
            Message = str,
            Code = 0
        };
    }

    public static Model.Result<T> ErrorReult<T>(T data, string str = "操作失败")
    {
        return new Result<T>()
        {
            Data = data,
            Message = str,
            Code = 500
        };
    }

    public static Model.Result<T> ErrorReult<T>(string str = "操作失败")
    {
        return new Result<T>()
        {
            Message = str,
            Code = 500
        };
    }

    public static Model.Result<string> ErrorReultString(string str = "操作失败")
    {
        return new Result<string>()
        {
            Message = str,
            Code = 500
        };
    }

    public static Model.Result<T> AuthenticationFailed<T>()
    {
        return new Result<T>()
        {
            Code = 10001,
            Message = "未登录"
        };
    }

}
